package com.geo.smallcredit.adapter;

import java.util.List;

import net.tsz.afinal.FinalBitmap;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.geo.smallcredit.R;
import com.geo.smallcredit.utils.net.ImageURL;
import com.geo.smallcredit.vo.FinancialChildLvVo.FinancialChildLv_list;

public class FinancialChildLvAdapter extends BaseAdapter {

	private Context context;
	private List<FinancialChildLv_list> list;
	
	public FinancialChildLvAdapter(Context context, List<FinancialChildLv_list> list) {
		super();
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}
viewHolder vh;
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView==null){
			vh=new viewHolder();
			convertView=LayoutInflater.from(context).inflate(R.layout.financialchild_item,null);
			vh.img=(ImageView) convertView.findViewById(R.id.financial_child_item_img);
			vh.title=(TextView) convertView.findViewById(R.id.financial_child_item_title);
			vh.desc=(TextView) convertView.findViewById(R.id.financial_child_item_desc);
			convertView.setTag(vh);
		}
		vh=(viewHolder) convertView.getTag();
		FinalBitmap.create(context).display(vh.img,ImageURL.IMG_URL+list.get(position).getImage());
		vh.title.setText(list.get(position).getTitle());
		vh.desc.setText(list.get(position).getContent());
		return convertView;
	}
class viewHolder{
	ImageView img;
	TextView title,desc;
}
}
